package com.showsu.editor.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.showsu.editor.entity.doo.UserPrivilege;
import com.showsu.editor.entity.po.TblUserPrivilege;
import com.showsu.editor.enums.VipLevelEnum;

import java.util.Date;

/**
 * @Author: William
 * @Description:
 * @Date: Created in 2:30 下午 2024/9/14
 * @Modified By:
 */
public interface IUserPrivilegeService extends IService<TblUserPrivilege> {

    /**
     * 查询用户某项权益的信息
     * @param userId
     * @param privilegeName
     * @return
     */
    UserPrivilege queryByUserIdAndPrivilegeName(Long userId, String privilegeName);

    /**
     * 用户到期的时候，会调用这个接口把用户权益全部置为零
     * @param userId
     * @return
     */
    int exipreUserPrivilege(Long userId);

    /**
     * 修改某个用户某权益的剩余次数
     * @param userId
     * @param privilegeName
     * @param remainTimes
     * @return
     */
    int updateUserPrivilege(Long userId, String privilegeName, Integer remainTimes);

    /**
     * 给用户赋予权益
     * @param userId
     * @param vipLevelEnum
     * @param vipEndTime 到期时间
     * @param orderTradeNo 系统订单号
     * @return
     */
    int handleUserPrivilege(Long userId, VipLevelEnum vipLevelEnum, Date vipEndTime, String orderTradeNo);
}
